package io.renren.controller;

import io.renren.annotation.Login;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.common.utils.RequestPage;
import io.renren.common.validator.Assert;
import io.renren.service.JxBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/***
 *
 */
@RestController
@RequestMapping("/api/jxBanner")
@Api(tags="banner位")
public class ApiJxBannerController {
    @Autowired
    private JxBannerService jxBannerService;
    /**
     * 列表
     */


    @PostMapping("list")
    @ApiOperation("实验室列表")
    public R list(@RequestBody RequestPage page){
        Assert.isNull(page, "分页数和每页显示不能为空!");
        Map<String,Object> params=new HashMap<String,Object>();
        params.put("limit",page.getLimit());
        params.put("page",page.getPage());
        params.put("type",page.getType());
        PageUtils pu = jxBannerService.getAllWithPage(params);
        return R.ok().put("page",pu);
    }
}
